package com.ydd.controller.admin;

import com.ydd.dto.YddAdvimgPageDTO;
import com.ydd.entity.YddAdvimg;
import com.ydd.result.Result;
import com.ydd.service.AdvimgService;
import com.ydd.vo.DataListVO;
import com.ydd.vo.YddAdvimgListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ydd_advimg")
@Slf4j
@Api(tags = "广告图片管理")
public class AdvimgController {
    @Autowired
    public AdvimgService advimgService;

    /**
     * 广告图分页查询
     * @param yddAdvimgPageDTO
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("广告图分页查询")
    public Result findpage(YddAdvimgPageDTO yddAdvimgPageDTO){
        DataListVO dataListVO=advimgService.findpage(yddAdvimgPageDTO);
        return Result.success(dataListVO);
    }

    /**
     * 根据id查询广告图详情
     * @return
     */
    @GetMapping("/rowInfo")
    @ApiOperation("根据id查询广告图详情")
    public Result findAll(String id){
        YddAdvimg yddAdvimg=advimgService.findAll(id);
        return Result.success(yddAdvimg);
    }
}
